<{include file='customer/head.html'}>
<style>
.status_ok{color:blue}
</style>
<body>

<div class="akr_main_inner_bg">
	<div class="wid97">
		<input type="button" class="akrBtn blue userAdd" value="+&nbsp;添加">
		<div class="inforBar">
			<span>状态：</span>
			<select class="status mr10">
				<option value="-1">全部</option>	
				<option value="0">未启用</option>
				<option value="1">正常</option>
				<option value="2">停用</option>
			</select>
			<span>职位：</span>
			<select class="type mr10">
				<option value="-1">全部</option>	
				<option value="0">研发</option>
				<option value="1">销售</option>
				<option value="2">技术</option>
			</select>
			<span>权限：</span>
			<select class="powerlist mr10">
				<option value="-1">全部</option>	
				<option value="1">创建</option>
				<option value="2">项目经理审核</option>
				<option value="4">总经理审核</option>
				<option value="8">研发</option>
				<option value="16">完成</option>
			</select>
			<span>登陆名：</span><input type="text" name="name" value="" class="inputText">
			<input type="button" class="akrBtn blue userSousou" value="搜索">
		</div>
	</div>
	<table class="akrTable akrTable_back">
		<thead>
			<tr>
				<th>ID</th>
				<th>头像</th>
				<th>登陆名称</th>
				<th>显示名称</th>
				<th>职位</th>
				<th>性别</th>
				<th>手机</th>
				<th>最后登陆时间</th>
				<th>最后登陆IP</th>
				<th>创建时间</th>
				<th>状态</th>
				<th>创|项审|总审|研|完</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody class="userlist_html">
			<{foreach $list as $k=>$v}>
				<tr>
					<td><{$v.id}></td>
					<td><{if $v.face!=''}> <img class="headImg" src="<{$v.face}>" > <{/if}> </td>
					<td><{$v.name}></td>
					<td><{$v.displayname}></td>
					<td><{if (is_numeric($v.type)) && ($v.type==0)}>研发<{elseif $v.type==1}>销售<{elseif $v.type==2}>技术<{elseif $v.isitadministrator==1 }>管理员<{else}>未知<{/if}></td>
					<td><{$v.sex}></td>
					<td><{$v.mobile}></td>
					<td><{$v.lastlogintime|date_format:"%Y-%m-%d<br>%H:%M:%S"}></td>
					<td><{$v.lastloginip}></td>
					<td><{$v.addtime|date_format:"%Y-%m-%d<br>%H:%M:%S"}></td>
					<td><{if $v.status==1}>正常<{elseif $v.status==2}>停止<{elseif $v.status==0}>未启用<{else}>未知<{/if}></td>
					<td>
						<!-- ok 有权限 no 没有权限 -->
						<{if $v.powerlist & 1}><span class="status_ok">创</span><{else}><span  class="status_no">创</span><{/if}>
						<{if $v.powerlist & 2}><span class="status_ok">项审</span><{else}><span  class="status_no">项审</span><{/if}>
						<{if $v.powerlist & 4}><span class="status_ok">总审</span><{else}><span  class="status_no">总审</span><{/if}>
						<{if $v.powerlist & 8}><span class="status_ok">研</span><{else}><span  class="status_no">研</span><{/if}>
						<{if $v.powerlist & 16}><span class="status_ok">完</span><{else}><span  class="status_no">完</span><{/if}>
					</td>
					<td>
						<{if $v.name!='admin'}>
						<span class="spanBtn" onclick="userEdit('<{$v.id}>')">编辑</span>
						<{/if}>
					</td>
				</tr>
			<{/foreach}>
		</tbody>
	</table>
</div>

<script type="text/javascript">
	//编辑
	function userEdit(id){
		_hcinits.init(['_layer_admin_min'],function(){
			_layer_admin=_hcinits._layer_admin;
			_layer_admin.open('编辑','/User/userEdit?id='+id);
		})
	}
	$(function(){
		//添加
		$('.userAdd').click(function(){
			var addurl='<{$pmsroot}>/User/userAdd';
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('添加用户',addurl);
			})
		})
		//搜索
		$('.userSousou').click(function(){
			_hcinits.init(['_ajaxs_min','_form_min','_layer_admin_min'],function(){
				_ajaxs=_hcinits._ajaxs;
				_layer_admin=_hcinits._layer_admin;
				_form=_hcinits._form;
				var url='';
				url+=_form.geturl('name','name','name','');
				url+=_form.geturl('select','.status','status','-1');
				url+=_form.geturl('select','.type','type','-1');
				url+=_form.geturl('select','.powerlist','powerlist','-1');
				url=_form.geturl('url',url);
				if(url!=''){url+='&sousou=1';}else{url+='sousou=1';}
				_ajaxs.post('/User/userList',url,function(data){
					if(data.status){
						$('.userlist_html').html(data.data);
					}else{
						_layer_admin.errorMsg(data.message);
					}
				})
			})
		})
	})
</script>

</body>
</html>